package com.example.art_cloud_backend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.art_cloud_backend.model.dto.picture.PictureQueryRequest;
import com.example.art_cloud_backend.model.dto.picture.PictureReviewRequest;
import com.example.art_cloud_backend.model.dto.picture.PictureUploadByBatchRequest;
import com.example.art_cloud_backend.model.dto.picture.PictureUploadRequest;
import com.example.art_cloud_backend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.art_cloud_backend.model.entity.User;
import com.example.art_cloud_backend.model.vo.picture.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
* @author Administrator
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-08-03 20:37:00
*/
public interface PictureService extends IService<Picture> {
    /**
     * 上传图片
     *
     * @param inputSource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     * 获取查询条件
     * @param pictureQueryRequest 图片查询请求
     * @return 查询条件
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     * 转换图片VO
     * @param picture 图片
     * @param request 请求
     * @return 图片VO
     */
    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     * 分页获取图片封装
     * @param picturePage 图片分页
     * @param request 请求
     * @return 图片VO分页
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    /**
     * 批量抓取和创建图片
     *
     * @param pictureUploadByBatchRequest
     * @param loginUser
     * @return 成功创建的图片数
     */
    Integer uploadPictureByBatch(
            PictureUploadByBatchRequest pictureUploadByBatchRequest,
            User loginUser
    );


    /**
     * 校验图片
     * @param picture 图片
     */
    void validPicture(Picture picture);

    /**
     * 审核图片
     *
     * @param pictureReviewRequest 请求参数
     * @param loginUser 审核人
     */
    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

    /**
     * 填充审核信息
     * @param picture 图片信息
     * @param user 用户信息
     */
    void fillReviewParams(Picture picture, User user);

    /**
     * 清除图片文件
     * @param picture 图片信息
     */
    void clearPictureFile(Picture picture);
}
